import { Component, OnInit, Input, Injector } from '@angular/core';
import { NgZorroPageBaseComponent } from '../../core/ng-zorro-page-base-component/ng-zorro-page-base-component.component';
import { HttpService } from "../../core/service/http.service";
import { Router, Route, ActivatedRoute, NavigationExtras } from "@angular/router";
import {
  AndOr, Compare, ExpressionPair, PagedResultDto, PagerSearchInput, ElementViewType, BaseComponentConfig, SonPagerSearchInput,
  SystemFormControl, FieldType, CustomNavigation, ElementShowType, KeyValueOutput, SystemFormControlOutput, DrillFormOutput,
  SystemFormOutput,
} from "../..";
import { NzMessageService, NzModalService } from 'ng-zorro-antd';
import {
  FormBuilder, FormGroup, FormsModule, ReactiveFormsModule, Validators,
  FormControl
} from "@angular/forms";

@Component({
  selector: 'app-drill-form',
  templateUrl: '../../core/ng-zorro-page-base-component/ng-zorro-page-base-component.component.html',
  styleUrls: ['../../core/ng-zorro-page-base-component/ng-zorro-page-base-component.component.scss']
})
export class DrillFormComponent extends NgZorroPageBaseComponent implements OnInit {
  constructor(injector: Injector) {
    super(injector,
      new BaseComponentConfig(
        "DrillFlow/GetPagerDrillForms",
        "DrillFlow/CreateDrillForm",
        "DrillFlow/UpdateDrillForm",
        "DrillFlow/GetDrillForm",
        "DrillFlow/DeteleDrillForm",
        "id",
        "DrillForm",
        "演练表单",
        null,
        "drillFlowId"
      ));
    this.showTitile = false;
  }

  getNewEntity(): DrillFormOutput {
    return new DrillFormOutput();
  }

  async navigateCustom(url: string, pid: any) {
    // const msgId = this.message.loading('正在获取数据', { nzDuration: 0 }).messageId;
    // try {
    //   const findEntity = await this.httpService.get<SystemFormOutput>(`${this.componentConfig.GetSingle}?input=${pid}`);
    //   if (findEntity) {
    //     const navigationExtras: NavigationExtras = {
    //       queryParams: { 'id': pid, 'caption': findEntity.formCaption }
    //     };
    //     this.router.navigate([url], navigationExtras);
    //   } else {
    //     this.message.error('无法确定表单信息！请刷新列表！');
    //   }
    // } finally {
    //   this.message.remove(msgId);
    // }
  }

  showModalForComponent(entity: any, tag: any) {
    throw new Error("Method not implemented.");
  }
}
